package online.flowerinsnow.minecraft.bukkit.manhunt.runnable;

import org.bukkit.scheduler.BukkitRunnable;
import online.flowerinsnow.minecraft.bukkit.manhunt.Manhunt;
import online.flowerinsnow.minecraft.bukkit.manhunt.util.FileUtils;

import java.io.File;

public class DeleteFileRunnable extends BukkitRunnable {
    public final File file;
    public final Runnable afterDone;
    public DeleteFileRunnable(File file, Runnable afterDone) {
        this.file = file;
        this.afterDone = afterDone;
        new BukkitRunnable() {
            @Override
            public void run() {
                afterDone.run();
            }
        }.runTask(Manhunt.getInstance());
    }
    @Override
    public void run() {
        FileUtils.rm_rf(file);
    }
    public void start() {
        runTaskAsynchronously(Manhunt.getInstance());
    }
}
